import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { inspectioPointVO, inspectioPointForm, inspectioPointQuery } from '@/api/facility/inspection/inspectio-point/types';

/**
 * 查询巡检-点位列表
 * @param query
 * @returns {*}
 */

export const listinspectioPoint = (query?: inspectioPointQuery): AxiosPromise<inspectioPointVO[]> => {
  return request({
    url: '/inspection/inspectio-point/list',
    method: 'get',
    params: query
  });
};

export const getPlanPageList = (query?: inspectioPointQuery): AxiosPromise<inspectioPointVO[]> => {
  return request({
    url: '/inspection/inspectio-point/queryPlanPageList',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡检-点位详细
 * @param patrolInspectionPointId
 */
export const getinspectioPoint = (patrolInspectionPointId: string | number): AxiosPromise<inspectioPointVO> => {
  return request({
    url: '/inspection/inspectio-point/' + patrolInspectionPointId,
    method: 'get'
  });
};

/**
 * 新增巡检-点位
 * @param data
 */
export const addinspectioPoint = (data: inspectioPointForm) => {
  return request({
    url: '/inspection/inspectio-point',
    method: 'post',
    data: data
  });
};

/**
 * 修改巡检-点位
 * @param data
 */
export const updateinspectioPoint = (data: inspectioPointForm) => {
  return request({
    url: '/inspection/inspectio-point',
    method: 'put',
    data: data
  });
};

/**
 * 删除巡检-点位
 * @param patrolInspectionPointId
 */
export const delinspectioPoint = (patrolInspectionPointId: string | number | Array<string | number>) => {
  return request({
    url: '/inspection/inspectio-point/' + patrolInspectionPointId,
    method: 'delete'
  });
};
